package com.power.project.controller;


import com.alibaba.fastjson2.JSONObject;
import com.power.common.domain.ResponseDTO;
import com.power.project.api.IDepartManagerFeign;
import com.power.project.model.vo.feignvo.Depart;
import com.power.project.model.vo.feignvo.Tag;
import com.power.project.model.vo.feignvo.TagUser;
import com.power.project.service.Ww_departService;
import com.power.project.service.Ww_tagService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * 企业微信查询接口适配。
 * 查询所有标签、部门
 */
@RestController
@Api(value = "企业微信查询接口适配", tags = {"查询所有标签、部门"})
public class DepartManagerController implements IDepartManagerFeign {

    @Resource
    private Ww_departService ww_departService;

    @Resource
    private Ww_tagService ww_tagService;


    @Override
    public ResponseDTO<JSONObject> queryAllTag(String tenantId) {
        List<Tag> tags = ww_tagService.queryAllTagWechat(tenantId);
        List<TagUser> tagUsers = ww_tagService.queryAllTagUserWechat(tenantId);
        JSONObject data = new JSONObject();
        data.put("tag", tags);
        data.put("taguser", tagUsers);
        return ResponseDTO.succData(data);
    }

    @Override
    public ResponseDTO<List<Depart>> listDept(String tenantId) {
        return ResponseDTO.succData(ww_departService.queryAllDepartWechat(tenantId));
    }
}
